package com.treasure.service.task.config;

import com.treasure.service.task.service.TaskSchedulerJobService;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @Description:
 * @version 1.0
 * @author panxinwen 2018/10/29 16:14
 * @Copyright © 2015 | 武汉京航科技有限公司 Email:19919866605@163.com
 * */


@Component
public class JobInitListener implements ApplicationListener<ApplicationReadyEvent> {
    @Override
    public void onApplicationEvent(final ApplicationReadyEvent event) {
        TaskSchedulerJobService bean = (TaskSchedulerJobService)event.getApplicationContext().getBean("taskSchedulerJobServiceImpl");
        bean.initScheduleJob();
    }

}
